package com.ruoyi.mdm.service.impl;

import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.mdm.domain.*;
import com.ruoyi.mdm.mapper.*;
import com.ruoyi.mdm.service.ISkuMasterService;
import com.ruoyi.mdm.service.ISkuMergeMasterService;
import com.ruoyi.mdm.service.ISkumInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;

/**
 * skum主Service业务层处理
 *
 * @author shiseido
 * @date 2025-03-01
 */
@Service
@Slf4j
public class SkuMergeMasterServiceImpl implements ISkuMergeMasterService {
    @Autowired
    private SkuMergeMasterMapper skuMergeMasterMapper;

    @Autowired
    private SkuMergeMasterSubMapper skuMergeMasterSubMapper;

    @Autowired
    private SkuProductMasterSubMapper skuProductMasterSubMapper;

    @Autowired
    private ISkumInfoService skumInfoService;

    @Autowired
    private SkuMasterMapper skuMasterMapper;

    @Autowired
    private ISkuMasterService skuMasterService;

    @Autowired
    private SkuSampleMapper skuSampleMapper;

    /**
     * 查询skum主
     *
     * @param id skum主主键
     * @return skum主
     */
    @Override
    public SkuMergeMaster selectSkuMergeMasterById(Long id) {
        return skuMergeMasterMapper.selectSkuMergeMasterById(id);
    }

    /**
     * 查询skum主列表
     *
     * @param skuMergeMaster skum主
     * @return skum主
     */
    @Override
    public List<SkuMergeMaster> selectSkuMergeMasterList(SkuMergeMaster skuMergeMaster) {
        return skuMergeMasterMapper.selectSkuMergeMasterList(skuMergeMaster);
    }

    /**
     * 新增skum主
     *
     * @param skuMergeMaster skum主
     * @return 结果
     */
    @Transactional
    @Override
    public int insertSkuMergeMaster(SkuMergeMaster skuMergeMaster) {

        // 相同品牌，SKUM中文名称不能相同
        SkuMergeMaster skuMergeMasterCheck = new SkuMergeMaster();
        skuMergeMasterCheck.setOwnerId(skuMergeMaster.getOwnerId());
        skuMergeMasterCheck.setSkumName(skuMergeMaster.getSkumName());
        List<SkuMergeMaster> skuMergeMasterCheckList
                = skuMergeMasterMapper.selectSkuMergeMasterList(skuMergeMasterCheck);
        if (StringUtils.isNotEmpty(skuMergeMasterCheckList)) {
            throw new ServiceException("同一个品牌下，已存在此SKUM！");
        }

        skuMergeMaster.setCreateTime(DateUtils.getNowDate());
        skuMergeMaster.setUpdateTime(DateUtils.getNowDate());
        skuMergeMasterMapper.insertSkuMergeMaster(skuMergeMaster);

        // 生成编码
        skuMergeMaster.setSkumCode("M" + skuMergeMaster.getOwnerId() + String.format("%07d", skuMergeMaster.getId()));
        skuMergeMasterMapper.updateSkuMergeMaster(skuMergeMaster);

        if (StringUtils.isNotEmpty(skuMergeMaster.getSpuCode())) {
            SkuProductMasterSub skuProductMasterSub = new SkuProductMasterSub();
            skuProductMasterSub.setSkumId(skuMergeMaster.getId());
            skuProductMasterSub.setOwnerId(skuMergeMaster.getOwnerId());
            skuProductMasterSub.setSkumCode(skuMergeMaster.getSkumCode());
            skuProductMasterSub.setSpuCode(skuMergeMaster.getSpuCode());
            skuProductMasterSub.setCreateBy(skuMergeMaster.getCreateBy());
            skuProductMasterSub.setUpdateBy(skuMergeMaster.getUpdateBy());
            skuProductMasterSub.setCreateTime(DateUtils.getNowDate());
            skuProductMasterSub.setUpdateTime(DateUtils.getNowDate());
            skuProductMasterSubMapper.insertSkuProductMasterSub(skuProductMasterSub);
        }

        // 同步新增ES-SKUM 异步处理
        syncSkumToEs(skuMergeMaster.getId());

        return 1;
    }

    /**
     * 修改skum主
     *
     * @param skuMergeMaster skum主
     * @return 结果
     */
    @Transactional
    @Override
    public int updateSkuMergeMaster(SkuMergeMaster skuMergeMaster) {

        // 相同品牌，SKUM中文名称不能相同
        SkuMergeMaster skuMergeMasterCheck = new SkuMergeMaster();
        skuMergeMasterCheck.setOwnerId(skuMergeMaster.getOwnerId());
        skuMergeMasterCheck.setSkumName(skuMergeMaster.getSkumName());
        List<SkuMergeMaster> skuMergeMasterCheckList
                = skuMergeMasterMapper.selectSkuMergeMasterList(skuMergeMasterCheck);
        if (StringUtils.isNotEmpty(skuMergeMasterCheckList)) {
            SkuMergeMaster skuMergeMaster1 = skuMergeMasterCheckList.get(0);
            if (skuMergeMaster1.getId().compareTo(skuMergeMaster.getId()) != 0) {
                throw new ServiceException("同一个品牌下，已存在此SKUM！");
            }
            compareSkum(skuMergeMaster, skuMergeMaster1);
        }


        // SPU关联查询
        SkuProductMasterSub skuProductMasterSub = skuProductMasterSubMapper.selectSkuProductMasterSubBySkumCode(
                skuMergeMaster.getSkumCode());

        // 如果存在删除，再新增关联
        if (skuProductMasterSub != null) {
            skuProductMasterSubMapper.deleteSkuProductMasterSubById(skuProductMasterSub.getId());
        }

        if (StringUtils.isNotEmpty(skuMergeMaster.getSpuCode())) {
            skuProductMasterSub = new SkuProductMasterSub();
            skuProductMasterSub.setSkumId(skuMergeMaster.getId());
            skuProductMasterSub.setOwnerId(skuMergeMaster.getOwnerId());
            skuProductMasterSub.setSkumCode(skuMergeMaster.getSkumCode());
            skuProductMasterSub.setSpuCode(skuMergeMaster.getSpuCode());
            skuProductMasterSub.setCreateBy(skuMergeMaster.getUpdateBy());
            skuProductMasterSub.setUpdateBy(skuMergeMaster.getUpdateBy());
            skuProductMasterSub.setCreateTime(DateUtils.getNowDate());
            skuProductMasterSub.setUpdateTime(DateUtils.getNowDate());
            skuProductMasterSubMapper.insertSkuProductMasterSub(skuProductMasterSub);
        }

//        skuMergeMaster.setSkumNetWeight(skuMergeMaster.getSkumNetWeight());
//        skuMergeMaster.setSkumNetWeightUnit(skuMergeMaster.getSkumNetWeightUnit());
//        skuMergeMaster.setUpdateBy(skuMergeMaster.getUpdateBy());
        skuMergeMaster.setUpdateTime(DateUtils.getNowDate());
        skuMergeMasterMapper.updateSkuMergeMaster(skuMergeMaster);

        // 同步新增ES-SKUM 异步处理
        syncSkumToEs(skuMergeMaster.getId());

        return 1;
    }

    private void compareSkum(SkuMergeMaster skuMergeMaster, SkuMergeMaster skuMasterSubOld) {
        log.debug("enter compareSkum,new skum={},old skum={}", skuMergeMaster, skuMasterSubOld);
        //容量比对
//        if (StringUtils.isNotEmpty(skuMergeMaster.getSkumNetWeight()) && StringUtils.isNotEmpty(skuMasterSubOld.getSkumNetWeight())){
        if (!skuMergeMaster.getSkumNetWeight().equalsIgnoreCase(skuMasterSubOld.getSkumNetWeight())) {

            SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
            skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
            skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
            skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
            skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKUM_CONTENT.getDesc()));
            skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
            skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSkumNetWeight());
            skuSampleUpdateLog.setNewValue(skuMergeMaster.getSkumNetWeight());
            skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
            skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
            skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);

            //追溯历史
//                SkuSampleUpdateLog updateLog = new SkuSampleUpdateLog();
//                updateLog.setOwnerId(skuMergeMaster.getOwnerId());
//                updateLog.setSkuCode(skuMergeMaster.getSkumCode());
//                updateLog.setMtype(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKU_CONTENT.getDesc());
//                List<SkuSampleUpdateLog> retList = skuSampleMapper.getSkuSampleUpdateLog(updateLog);
//                if (null == retList || retList.isEmpty()) {
//
//
//                }
//                    SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
//                    skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
//                    skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
//                    skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
//                    skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKU_CONTENT.getDesc()));
//                    skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
//                    skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSkumNetWeight());
//                    skuSampleUpdateLog.setNewValue(skuMergeMaster.getSkumNetWeight());
//                    skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
//                    skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
//                    skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);
//                } else {
//                    SkuSampleUpdateLog tmpLog = retList.get(0);
//                    tmpLog.setOldValue(skuMasterSubOld.getSkumNetWeight());
//                    tmpLog.setNewValue(skuMergeMaster.getSkumNetWeight());
//                    tmpLog.setUpdateTime(DateUtils.getNowDate());
//                    skuSampleMapper.updateSkuSampleUpdateLog(tmpLog);
//                }
        }
//        }

        //容量单位比对
//        if (StringUtils.isNotEmpty(skuMergeMaster.getSkumNetWeightUnit()) && StringUtils.isNotEmpty(skuMasterSubOld.getSkumNetWeightUnit())){
        if (!skuMergeMaster.getSkumNetWeightUnit().equalsIgnoreCase(skuMasterSubOld.getSkumNetWeightUnit())) {

            SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
            skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
            skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
            skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
            skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKUM_CONTENTUNIT.getDesc()));
            skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
            skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSkumNetWeightUnit());
            skuSampleUpdateLog.setNewValue(skuMergeMaster.getSkumNetWeightUnit());
            skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
            skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
            skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);
        }

        if (0 != skuMergeMaster.getSkumSalePrice().compareTo(skuMasterSubOld.getSkumSalePrice())) {

            SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
            skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
            skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
            skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
            skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKUM_PRICE.getDesc()));
            skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
            skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSkumSalePrice().setScale(2, RoundingMode.HALF_UP).toString());
            skuSampleUpdateLog.setNewValue(skuMergeMaster.getSkumSalePrice().setScale(2, RoundingMode.HALF_UP).toString());

            skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
            skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
            skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);
        }

        //追溯历史
//                SkuSampleUpdateLog updateLog = new SkuSampleUpdateLog();
//                updateLog.setOwnerId(skuMergeMaster.getOwnerId());
//                updateLog.setSkuCode(skuMergeMaster.getSkumCode());
//                updateLog.setMtype(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKU_CONTENTUNIT.getDesc());
//                List<SkuSampleUpdateLog> retList = skuSampleMapper.getSkuSampleUpdateLog(updateLog);
//                if (null == retList || retList.isEmpty()) {
//                    SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
//                    skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
//                    skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
//                    skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
//                    skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKU_CONTENTUNIT.getDesc()));
//                    skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
//                    skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSkumNetWeightUnit());
//                    skuSampleUpdateLog.setNewValue(skuMergeMaster.getSkumNetWeightUnit());
//                    skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
//                    skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
//                    skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);
//                } else {
//                    SkuSampleUpdateLog tmpLog = retList.get(0);
//                    tmpLog.setOldValue(skuMasterSubOld.getSkumNetWeightUnit());
//                    tmpLog.setNewValue(skuMergeMaster.getSkumNetWeightUnit());
//                    tmpLog.setUpdateTime(DateUtils.getNowDate());
//                    skuSampleMapper.updateSkuSampleUpdateLog(tmpLog);
//                }
//            }
//        }

        //spu比对
//        if (StringUtils.isNotEmpty(skuMergeMaster.getSpuCode()) && StringUtils.isNotEmpty(skuMasterSubOld.getSpuCode())){
        if (!skuMergeMaster.getSpuCode().equalsIgnoreCase(skuMasterSubOld.getSpuCode())) {

            SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
            skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
            skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
            skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
            skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKUM_SPU.getDesc()));
            skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
            skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSpuCode());
            skuSampleUpdateLog.setNewValue(skuMergeMaster.getSpuCode());
            skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
            skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
            skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);
        }


            //追溯历史
//                SkuSampleUpdateLog updateLog = new SkuSampleUpdateLog();
//                updateLog.setOwnerId(skuMergeMaster.getOwnerId());
//                updateLog.setSkuCode(skuMergeMaster.getSkumCode());
//                updateLog.setMtype(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKU_SPU.getDesc());
//                List<SkuSampleUpdateLog> retList = skuSampleMapper.getSkuSampleUpdateLog(updateLog);
//                if (null == retList || retList.isEmpty()) {
//                    SkuSampleUpdateLog skuSampleUpdateLog = new SkuSampleUpdateLog();
//                    skuSampleUpdateLog.setOwnerId(skuMergeMaster.getOwnerId());
//                    skuSampleUpdateLog.setSkuCode(skuMergeMaster.getSkumCode());
//                    skuSampleUpdateLog.setSkuName(skuMergeMaster.getSkumName());
//                    skuSampleUpdateLog.setMtype(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_TYPE.SKU_SPU.getDesc()));
//                    skuSampleUpdateLog.setMmodule(String.valueOf(SkuMasterConstants.SKU_SAMPLE_M_MODULE.SKUM.getDesc()));
//                    skuSampleUpdateLog.setOldValue(skuMasterSubOld.getSpuCode());
//                    skuSampleUpdateLog.setNewValue(skuMergeMaster.getSpuCode());
//                    skuSampleUpdateLog.setUpdateBy(skuMergeMaster.getCreateBy());
//                    skuSampleUpdateLog.setUpdateTime(DateUtils.getNowDate());
//                    skuSampleMapper.insertSkuSampleUpdateLog(skuSampleUpdateLog);
//                } else {
//                    SkuSampleUpdateLog tmpLog = retList.get(0);
//                    tmpLog.setOldValue(skuMasterSubOld.getSpuCode());
//                    tmpLog.setNewValue(skuMergeMaster.getSpuCode());
//                    tmpLog.setUpdateTime(DateUtils.getNowDate());
//                    skuSampleMapper.updateSkuSampleUpdateLog(tmpLog);
//                }
//        }
//        }

    }


    @Async
    public void syncSkumToEs(Long skumId) {
        // 同步新增ES-SKUM
        SkuMergeMaster skuMergeMaster = skuMergeMasterMapper.selectSkuMergeMasterById(skumId);
        syncSkumToEs(skuMergeMaster);

        // 同步新增ES-SKU
        SkuMaster skuSelectMaster = new SkuMaster();
        skuSelectMaster.setSkumId(skumId);
        List<SkuMaster> skuMasterList = skuMasterMapper.selectSkuMasterToEs(skuSelectMaster);
        if (!skuMasterList.isEmpty()) {
            skuMasterService.syncSkuToEs(skuMasterList, false);
        }

    }

    /**
     * 批量删除skum主
     *
     * @param ids 需要删除的skum主主键
     * @return 结果
     */
    @Override
    public int deleteSkuMergeMasterByIds(Long[] ids) {
        return skuMergeMasterMapper.deleteSkuMergeMasterByIds(ids);
    }

    /**
     * 删除skum主信息
     *
     * @param id skum主主键
     * @return 结果
     */
    @Override
    public int deleteSkuMergeMasterById(Long id) {
        return skuMergeMasterMapper.deleteSkuMergeMasterById(id);
    }

    /**
     * 同步SKUM到ES
     *
     * @param skuMergeMaster spu信息
     */
    @Override
    public void syncSkumToEs(SkuMergeMaster skuMergeMaster) {

        // 同步更新ES-SPU
        SkumInfoEntity skumInfoEntity = new SkumInfoEntity();
        BeanUtils.copyProperties(skuMergeMaster, skumInfoEntity);
        skumInfoEntity.setCreateTime(DateUtils.parseDateToTStr(skuMergeMaster.getCreateTime()));
        skumInfoEntity.setUpdateTime(DateUtils.parseDateToTStr(skuMergeMaster.getUpdateTime()));

        // 品牌名称
//        String goodsBrandName = DictUtils.getDictLabel("goods_brand", skuMergeMaster.getOwnerId());
        StringBuffer keyword = new StringBuffer();
//        keyword = keyword.append(skuMergeMaster.getOwnerId()).append(" ");
//        keyword = keyword.append(goodsBrandName).append(" ");
        keyword = keyword.append(skuMergeMaster.getSkumName()).append(" ");
        keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumNameEn(), "")).append(" ");
        keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumShortName(), ""));
        keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumNetWeight(), ""));
        keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumNetWeightUnit(), ""));
        skumInfoEntity.setKeyword(keyword.toString());

        skumInfoService.add(skumInfoEntity);
    }

    /**
     * 同步SKUM到ES
     *
     * @param skuMergeMasterList spu信息
     */
    @Override
    public void syncSkumToEs(List<SkuMergeMaster> skuMergeMasterList) {

        List<SkumInfoEntity> skumInfoEntityList = new ArrayList<>();

        for (SkuMergeMaster skuMergeMaster : skuMergeMasterList) {

            // 同步更新ES-SPU
            SkumInfoEntity skumInfoEntity = new SkumInfoEntity();
            BeanUtils.copyProperties(skuMergeMaster, skumInfoEntity);
            skumInfoEntity.setCreateTime(DateUtils.parseDateToTStr(skuMergeMaster.getCreateTime()));
            skumInfoEntity.setUpdateTime(DateUtils.parseDateToTStr(skuMergeMaster.getUpdateTime()));

            // 品牌名称
//            String goodsBrandName = DictUtils.getDictLabel("goods_brand", skuMergeMaster.getOwnerId());
            StringBuffer keyword = new StringBuffer();
//            keyword = keyword.append(skuMergeMaster.getOwnerId()).append(" ");
//            keyword = keyword.append(goodsBrandName).append(" ");
            keyword = keyword.append(skuMergeMaster.getSkumName()).append(" ");
            keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumNameEn(), "")).append(" ");
            keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumShortName(), ""));
            keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumNetWeight(), ""));
            keyword = keyword.append(StringUtils.nvl(skuMergeMaster.getSkumNetWeightUnit(), ""));
            skumInfoEntity.setKeyword(keyword.toString());

            skumInfoEntityList.add(skumInfoEntity);
        }

        skumInfoService.deleteAll();
        skumInfoService.addAll(skumInfoEntityList);
    }
}
